#include <iostream>
using namespace std;
/**
 * 
 */
int main() {
  double a, b;
  cin >> a >> b;
  int z = a / b;
  cout << a - z * b << endl;
  return 0;
}